package com.example.smartcity_poverty.ui.AllService.OA.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.MenuItem
import com.example.smartcity_poverty.R
import com.example.smartcity_poverty.logic.util.Util.show
import com.example.smartcity_poverty.ui.AllService.OA.activity.OaShowMeActivity.Companion.OaId
import com.example.smartcity_poverty.ui.AllService.OA.activity.OaShowMeActivity.Companion.OaName
import com.example.smartcity_poverty.ui.AllService.OA.activity.OaShowMeActivity.Companion.OaPhone
import com.example.smartcity_poverty.ui.AllService.OA.activity.OaShowMeActivity.Companion.OaSex
import com.example.smartcity_poverty.ui.AllService.OA.activity.OaShowMeActivity.Companion.OaThis
import com.example.smartcity_poverty.ui.AllService.OA.activity.OaShowMeActivity.Companion.OaTime
import kotlinx.android.synthetic.main.activity_oa_add_me.*

/**
 * 添加个人信息
 */
class OaAddMeActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        supportActionBar?.setDisplayHomeAsUpEnabled(true)
        setContentView(R.layout.activity_oa_add_me)
        title = "添加个人信息"

        // 点击添加信息
        oaAddMeOk.setOnClickListener {
            if (oaAddMeName.text.toString().isNotEmpty() ||
                oaAddMeSex.text.toString().isNotEmpty() ||
                oaAddMeId.text.toString().isNotEmpty() ||
                oaAddMeTime.text.toString().isNotEmpty() ||
                oaAddMePhone.text.toString().isNotEmpty() ||
                oaAddMeThis.text.toString().isNotEmpty()
            ){
                OaName = oaAddMeName.text.toString()
                OaSex = oaAddMeSex.text.toString()
                OaId = oaAddMeId.text.toString()
                OaTime = oaAddMeTime.text.toString()
                OaPhone = oaAddMePhone.text.toString()
                OaThis = oaAddMeThis.text.toString()
                "添加成功".show()
                finish()
            }else "不能为空！".show()
        }


    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        finish()
        return super.onOptionsItemSelected(item)
    }
}